import matplotlib.pyplot as plt
import numpy as np
import glob

plt.rc('axes', titlesize=14)     # fontsize of the axes title
plt.rc('axes', labelsize=14)    # fontsize of the x and y labels
plt.rc('xtick', labelsize=14)    # fontsize of the tick labels
plt.rc('ytick', labelsize=14)    # fontsize of the tick labels

t, nSD, nActive=np.loadtxt('SDvsTime/currentGP/SDvsTime.dat',unpack=True)


plt.plot(t/1e6,nSD/nActive, 'r-', zorder=10, label='giant planets in current orbits')

t, nSD, nActive=np.loadtxt('SDvsTime/instability/SDvsTime.dat',unpack=True)


plt.plot(t/1e6,nSD/nActive, 'k',linestyle='dotted',  label='giant planets in pre-instability orbits')

plt.legend()

plt.ylim(0,0.07)
plt.xlim(0, 50)
plt.xlabel('Time (t, Myr)')
plt.ylabel(r'$N_{SD}(t) / N_{active}(t)$')
plt.tight_layout()
plt.savefig('figS2.pdf', dpi=300)
